package com.itheima.controller;

import com.itheima.pojo.Result;
import com.itheima.service.UploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
public class UploadController {

    @Autowired
    private UploadService uploadService;

    @PostMapping("/upload")
    public Result upload(MultipartFile file) throws Exception {
     String url = uploadService.upload(file);
        return Result.success(url);
    }

}
